Warning: mkdir(): No space left on device in /var/www/tg-me/post.php on line 37

Warning: file_put_contents(aCache/aDaily/post/pyproglib/--): Failed to open stream: No such file or directory in /var/www/tg-me/post.php on line 50
Библиотека питониста | Python, Django, Flask | Telegram Webview: pyproglib/6775 -
Telegram Group & Telegram Channel
💭 Холивар: f-строки vs .format() vs %

Python предлагает сразу три способа форматирования строк — и у каждого есть свои фанаты.

Разбираемся по фактам:

🔎 f-строки (Python 3.6+):
name = "Alice"
age = 30
print(f"{name} is {age} years old.")


читаемо, лаконично
быстрее при выполнении
🙅‍♂️ не работает в Python < 3.6
🙅‍♂️ неудобно при кавычках внутри строк

🔎 .format():
name = "Alice"
age = 30
print("{} is {} years old.".format(name, age))


кросс-версионно (Python 2.7+ и 3.x)
хорош для шаблонов и повторов
🙅‍♂️ длиннее, особенно с ключами
🙅‍♂️ легко запутаться с порядком аргументов

🔎 Cтарый стиль %:
name = "Alice"
age = 30
print("%s is %d years old." % (name, age))


кратко для простых случаев
работает даже в старом Python
🙅‍♂️ типобезопасность на минималках
🙅‍♂️ легко сломать, особенно при refactoring’е

Выбор зависит от контекста:
🔘 f-строки — выбор для современного Python-кода
🔘 .format() — для совместимости и шаблонов
🔘 % — для ностальгирующих и логов

А вы что используете чаще всего?

❤️ f-строки — будущее уже здесь
👍 .format() / % — стабильность и привычка

P.S. Инструкция, как оставить коммент

Библиотека питониста #междусобойчик
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/pyproglib/6775
Create:
Last Update:

💭 Холивар: f-строки vs .format() vs %

Python предлагает сразу три способа форматирования строк — и у каждого есть свои фанаты.

Разбираемся по фактам:

🔎 f-строки (Python 3.6+):

name = "Alice"
age = 30
print(f"{name} is {age} years old.")


читаемо, лаконично
быстрее при выполнении
🙅‍♂️ не работает в Python < 3.6
🙅‍♂️ неудобно при кавычках внутри строк

🔎 .format():
name = "Alice"
age = 30
print("{} is {} years old.".format(name, age))


кросс-версионно (Python 2.7+ и 3.x)
хорош для шаблонов и повторов
🙅‍♂️ длиннее, особенно с ключами
🙅‍♂️ легко запутаться с порядком аргументов

🔎 Cтарый стиль %:
name = "Alice"
age = 30
print("%s is %d years old." % (name, age))


кратко для простых случаев
работает даже в старом Python
🙅‍♂️ типобезопасность на минималках
🙅‍♂️ легко сломать, особенно при refactoring’е

Выбор зависит от контекста:
🔘 f-строки — выбор для современного Python-кода
🔘 .format() — для совместимости и шаблонов
🔘 % — для ностальгирующих и логов

А вы что используете чаще всего?

❤️ f-строки — будущее уже здесь
👍 .format() / % — стабильность и привычка

P.S. Инструкция, как оставить коммент

Библиотека питониста #междусобойчик

BY Библиотека питониста | Python, Django, Flask




Share with your friend now:
tg-me.com/pyproglib/6775

View MORE
Open in Telegram


Библиотека питониста | Python Django Flask Telegram | DID YOU KNOW?

Date: |

How To Find Channels On Telegram?

There are multiple ways you can search for Telegram channels. One of the methods is really logical and you should all know it by now. We’re talking about using Telegram’s native search option. Make sure to download Telegram from the official website or update it to the latest version, using this link. Once you’ve installed Telegram, you can simply open the app and use the search bar. Tap on the magnifier icon and search for a channel that might interest you (e.g. Marvel comics). Even though this is the easiest method for searching Telegram channels, it isn’t the best one. This method is limited because it shows you only a couple of results per search.

Find Channels On Telegram?

Telegram is an aspiring new messaging app that’s taking the world by storm. The app is free, fast, and claims to be one of the safest messengers around. It allows people to connect easily, without any boundaries.You can use channels on Telegram, which are similar to Facebook pages. If you’re wondering how to find channels on Telegram, you’re in the right place. Keep reading and you’ll find out how. Also, you’ll learn more about channels, creating channels yourself, and the difference between private and public Telegram channels.

Библиотека питониста | Python Django Flask from sg


Telegram Библиотека питониста | Python, Django, Flask
FROM USA